package com.hqyj.bigdata_project.controller;

import com.hqyj.bigdata_project.entity.TopTenVideoInfo;
import com.hqyj.bigdata_project.json.R;
import com.hqyj.bigdata_project.service.TopTenCatalogInfoService;
import com.hqyj.bigdata_project.service.TopTenVideoInfoService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("video")
public class VideoInfoController {

    @Resource
    private TopTenVideoInfoService topTenVideoInfoService;



    @GetMapping("/topTen")
    public R queryTopTenVideoInfoList(){
        List<TopTenVideoInfo> topTenVideoInfoList = null;
        try{
            topTenVideoInfoList = topTenVideoInfoService.queryTopTenVideoInfoList();
            return R.success("查询播放量前十名的视频列表成功！",topTenVideoInfoList);
        }catch (Exception ex){
            ex.printStackTrace();
            return R.error("程序出现异常！");
        }
    }


}
